home *** CD-ROM | disk | FTP | other *** search
- * Program : Converts a string to lower case
- * Author : Stephen McNabb
- * Creation date : 21th February 1995
- * Last update : 21th February 1995
- * Parameters : a0 needs to contain address of string to convert
- * before jumping to the 'lower' routine
- * Output : The string is converted to lowercase
-
- start: jsr cls /clear the screen
- move.l #mess1,d0 /move address of message to d0
- jsr ptext /and display on screen
- move.l #str,d0 /move address of string for conversion to d0
- jsr ptext /and display on screen
- jsr line /display a new line
-
- move.l #str,a0 /move address of string for conversion to a0
- jsr lower /and change it to lowercase
- move.l #mess2,d0 /move address of message to d0
- jsr ptext /and display on screen
- move.l #str,d0 /move address of converted message to d0
- jsr ptext /and display on screen
- jsr line /dislay a new line
-
- end: bra exit /exit from program
-
- lower: movem.l d0,-(sp) /stack register
- lloop: move.b (a0),d0 /move character of string to d0
- cmpi.b #0,d0 /check if it is a null character
- beq lend /if so then it is the end of the string
- cmpi.b #'A',d0 /check if it is less than 'A'
- blt lnext /if so get another character
- cmpi.b #'Z',d0 /check if it is greater than 'Z'
- bgt lnext /if so get another chatacter
- addi.b #32,d0 /else convert it to lowercase
- move.b d0,(a0) /and move new character back to string
- lnext: add.l #1,a0 /increment a0 for next character
- bra lloop /and loop
- lend: movem.l (sp)+,d0 /unstack register
- rts /return from subroutine
-
- include "\SOURCE\FUNCTION.S" /include standard functions
-
- *** Program Data ***
-
- mess1: dc.b 'The string to convert to lower case is : ',0
- mess2: dc.b 'The string is now : ',0
- str: dc.b 'Convert THIS to LOwer Case',0
-
- *** End of File ***
-